<?php require admin_tpl('header')?>

<div class="tab">
	<ul>
		<li><a href="?mod=plugin&ac=inlist" <?php if ($ac=='inlist') { echo 'class="on"';}?>>已启用</a></li>
		<li><a href="?mod=plugin&ac=unlist" <?php if ($ac=='unlist') { echo 'class="on"';}?>>未启用</a></li>
	</ul>
</div>

<div class="main">

<?php if ( $ac == 'inlist' || $ac == 'unlist' ) : ?>
	<fieldset>
		<legend>安装说明：</legend>
		请将插件上传至 plugin 目录，然后到“未启用”列表中启用插件。
	</fieldset>
<?php endif; ?>

<?php if ( $ac == 'inlist' ) : ?>
	<table cellspacing="0" class="datalist" id="list">
		<tr>
			<th width="250" class="firstcol">插件名称</th>
			<th>插件描述</th>
		</tr>

		<?php
		if (empty($result)) {
			echo '<tr><td colspan="2">尚未启用任何插件...</td></tr>';
		} else {
			foreach ( $result as $key => $row ) {
		?>
		<tr>
			<td align="center">
			<?php echo $row['name']; ?>
			<br />
			<a href="?mod=plugin&ac=disable&plugin=<?php echo $key?>">禁用</a>
			</td>
			<td>
			<p style="color:#555;"><?php echo $row['description'];?></p>
			<p>版本： <?php echo $row['version'];?> |
			作者：<a href="<?php echo $row['authorurl']?$row['authorurl']:'#'?>" title="访问作者主页" target="_blank"><?php echo $row['author']?></a> |
			插件主页：<a href="<?php echo $row['url']?>" target="_blank"><?php echo $row['url']?></a></p>
			</td>
		</tr>
		<?php
			}
		}
		?>
	</table>
<?php elseif ( $ac == 'unlist' ) : ?>

	<table cellspacing="0" class="datalist" id="list">
		<tr>
			<th width="250" class="firstcol">插件名称</th>
			<th>插件描述</th>
		</tr>

		<?php
		if (empty($result)) {
			echo '<tr><td colspan="2">没有未启用的插件...</td></tr>';
		} else {
			foreach ( $result as $key => $row ) {
		?>
		<tr>
			<td align="center">
			<?php echo $row['name']; ?>
			<br />
			<a href="?mod=plugin&ac=enable&plugin=<?php echo $key?>">启用</a>
			</td>
			<td>
			<p style="color:#555;"><?php echo $row['description'];?></p>
			<p>版本： <?php echo $row['version'];?> |
			作者：<a href="<?php echo $row['authorurl']?$row['authorurl']:'#'?>" title="访问作者主页" target="_blank"><?php echo $row['author']?></a> |
			插件主页：<a href="<?php echo $row['url']?>" target="_blank"><?php echo $row['url']?></a></p>
			</td>
		</tr>
		<?php
			}
		}
		?>
	</table>

<?php endif;?>
</div>

<?php require admin_tpl('footer')?>